package com.rc.evcharger.common.utils.elec;

public class ElecPileFaultCodeUtil {

    public static final Integer NORMAL = 0x00;  //正常;

    public static final Integer OUTPUT_OVERVOLTAGE_A = 0x11;  //输出过压-A枪

    public static final Integer OUTPUT_OVERVOLTAGE_RECOVERY_A = 0x91;//输出过压恢复-A枪

    public static final Integer OUTPUT_OVERVOLTAGE_B = 0x12;  //输出过压-B枪

    public static final Integer OUTPUT_OVERVOLTAGE_RECOVERY_B = 0x92;//输出过压恢复-B枪

    public static final Integer OUTPUT_OVERCURRENT_A = 0x13;//输出过流-A枪

    public static final Integer OUTPUT_OVERCURRENT_RECOVERY_A = 0x93;//输出过流-A枪

    public static final Integer OUTPUT_OVERCURRENT_B = 0x14;//输出过流 B枪

    public static final Integer OUTPUT_OVERCURRENT_RECOVERY_B = 0x94;//输出过流-B枪

    public static final Integer BATTERY_UNCONNECTED_A = 0x15;// 电池未连接A-枪

    public static final Integer BATTERY_UNCONNECTED_RECOVERY_A = 0x95;// 电池未连接A-枪 恢复

    public static final Integer BATTERY_UNCONNECTED_B = 0x16;// 电池未连接B-枪

    public static final Integer BATTERY_UNCONNECTED_RECOVERY_B = 0x96;// 电池未连接B-枪 恢复

    public static final Integer ELEC_LOCK_FAULT_A = 0x17;// 电子锁故障A-枪

    public static final Integer ELEC_LOCK_FAULT_RECOVERY_A = 0x97;// 电子锁故障B-枪 恢复

    public static final Integer ELEC_LOCK_FAULT_B = 0x18;// 电子锁故障B-枪

    public static final Integer ELEC_LOCK_FAULT_RECOVERY_B = 0x98;// 电子锁故障B-枪 恢复

    public static final Integer GUN_CONNECTED_EXCEPTION_A = 0x19;// 枪连接异常A-枪

    public static final Integer GUN_CONNECTED_EXCEPTION_RECOVERY_A = 0x99;// 枪连接异常A-枪恢复

    public static final Integer GUN_CONNECTED_EXCEPTION_B = 0x20;// 枪连接异常B-枪

    public static final Integer GUN_CONNECTED_EXCEPTION_RECOVERY_B = 0xA0;// 枪连接异常B-枪恢复

    public static final Integer AMMETER_COMMUNICATION_EXCEPTION_A = 0x21;// 电表通信异常A-枪

    public static final Integer AMMETER_COMMUNICATION_EXCEPTION_RECOVERY_A = 0xA1;// 电表通信异常A-枪恢复

    public static final Integer AMMETER_COMMUNICATION_EXCEPTION_B = 0x22;// 电表通信异常B-枪

    public static final Integer AMMETER_COMMUNICATION_EXCEPTION_RECOVERY_B = 0xA2;// 电表通信异常B-枪恢复

    public static final Integer INSULATION_DETECTION_FAULT_A = 0x23;// 绝缘检测故障A-枪

    public static final Integer INSULATION_DETECTION_FAULT_RECOVERY_A = 0xA3;// 绝缘检测故障A-枪恢复

    public static final Integer INSULATION_DETECTION_FAULT_B = 0x24;// 绝缘检测故障B-枪

    public static final Integer INSULATION_DETECTION_FAULT_RECOVERY_B = 0xA4;// 绝缘检测故障B-枪恢复

    public static final Integer SCREEN_COMMUNICATION_EXCEPTION = 0x25;// 显示屏通信异常

    public static final Integer SCREEN_COMMUNICATION_EXCEPTION_RECOVERY = 0xA5;// 显示屏通信异常恢复

    public static final Integer GPRS_COMMUNICATION_EXCEPTION = 0x26;// GPRS通信异常

    public static final Integer GPRS_COMMUNICATION_EXCEPTION_RECOVERY = 0xA6;// GPRS通信异常

    public static final Integer READERCARD_COMMUNICATION_EXCEPTION = 0x27;// 读卡器通信异常

    public static final Integer READERCARD_COMMUNICATION_EXCEPTION_RECOVERY = 0xA7;// 读卡器通信异常恢复

    public static final Integer OUTPUT_CONTACTOR_EXCEPTION = 0x28;// 输出接触器异常

    public static final Integer OUTPUT_CONTACTOR_EXCEPTION_RECOVERY = 0xA8;// 输出接触器异常恢复

    public static final Integer URGENT_STOP = 0x29;// 急停故障

    public static final Integer URGENT_STOP_RECOVERY = 0xA9;// 急停故障恢复

    public static final Integer MODULAR_COMMUNICATION_EXCEPTION = 0x30;// 模块通信异常

    public static final Integer MODULAR_COMMUNICATION_EXCEPTION_RECOVERY = 0xB0;// 模块通信异常恢复

    public static final Integer INPUT_CONTACTOR_OBLIGATE = 0x31;// 输入接触器预留

    public static final Integer INPUT_CONTACTOR_OBLIGATE_RECOVERY = 0xB1;// 输入接触器预留恢复

    public static final Integer ENTRANCE_GUARD_FAULT = 0x32;// 门禁故障

    public static final Integer ENTRANCE_GUARD_FAULT_RECOVERY = 0xB2;// 门禁故障恢复

    public static final Integer XX_MODULE_OVERTEMPERATURE = 0x33;// xx模块过温

    public static final Integer MODULE_OVERTEMPERATURE_RECOVERY = 0xB3;//xx模块过温恢复

    public static final Integer XX_MODULE_FAN_FAULT = 0x34;// Xx模块风扇故障

    public static final Integer XX_MODULE_FAN_FAULT_RECOVERY = 0xB4;//Xx风扇故障恢复

    public static final Integer XX_MODULE_FAULT = 0x35;// Xx模块故障

    public static final Integer XX_MODULE_FAULT_RECOVERY = 0xB5;//Xx故障恢复

    public static final Integer XX_ID_REPEAT = 0x36;// xxID重复

    public static final Integer XX_ID_REPEAT_RECOVERY = 0xB6;//xxID重复恢复   输入电压异常

    public static final Integer INPUT_VOLTAGE_EXCEPTION = 0x37;// 输入电压异常

    public static final Integer INPUT_VOLTAGE_EXCEPTION_RECOVERY = 0xB7;//输入电压异常恢复

    public static final Integer SYSTEM_OVERTEMPERATURE = 0x38;//系统过温

    public static final Integer SYSTEM_OVERTEMPERATURE_RECOVERY = 0xB8;//系统过温恢复

    /**
     * 获取电桩的故障
     * @param faultCode
     * @return
     */
    public static String getResult(String faultCode){
        String fault = "";
        Integer faultCodeInt = Integer.parseInt(faultCode,16);
        switch (faultCodeInt){
            case 0x00:fault = "正常";break;
            case 0x11:fault = "输出过压-A枪";break;
            case 0x12:fault = "输出过压-B枪";break;
            case 0x13:fault = "输出过流A-枪";break;
            case 0x14:fault = "输出过流B-枪";break;
            case 0x15:fault = "电池未连接A-枪";break;
            case 0x16:fault = "电池未连接B-枪";break;
            case 0x17:fault = "电子锁故障A-枪";break;
            case 0x18:fault = "电子锁故障B-枪";break;
            case 0x19:fault = "枪连接异常A-枪";break;
            case 0x20:fault = "枪连接异常B-枪";break;
            case 0x21:fault = "电表通信异常A-枪";break;
            case 0x22:fault = "电表通信异常B-枪";break;
            case 0x23:fault = "绝缘检测故障A-枪";break;
            case 0x24:fault = "绝缘检测故障B-枪";break;
            case 0x25:fault = "显示屏通信异常";break;
            case 0x26:fault = "GPRS通信异常";break;
            case 0x27:fault = "读卡器通信异常";break;
            case 0x28:fault = "输出接触器异常";break;
            case 0x29:fault = "急停故障";break;
            case 0x30:fault = "模块通信异常";break;
            case 0x31:fault = "输入接触器预留";break;
            case 0x32:fault = "门禁故障";break;
            case 0x33:fault = "模块过温";break;
            case 0x34:fault = "模块风扇故障";break;
            case 0x35:fault = "模块故障";break;
            case 0x36:fault = "ID重复";break;
            case 0x37:fault = "输入电压异常";break;
            case 0x38:fault = "系统过温";break;
            case 0x91:fault = "输出过压A-枪恢复";break;
            case 0x92:fault = "输出过压B-枪恢复";break;
            case 0x93:fault = "输出过流A-枪恢复";break;
            case 0x94:fault = "输出过流B-枪恢复";break;
            case 0x95:fault = "电池未连接A-枪恢复";break;
            case 0x96:fault = "电池未连接B-枪恢复";break;
            case 0x97:fault = "电子锁故障A-枪恢复";break;
            case 0x98:fault = "电子锁故障B-枪恢复";break;
            case 0x99:fault = "枪连接异常A-枪恢复";break;
            case 0xA0:fault = "枪连接异常B-枪恢复";break;
            case 0xA1:fault = "电表通信异常A-枪恢复";break;
            case 0xA2:fault = "电表通信异常B-枪恢复";break;
            case 0xA3:fault = "绝缘检测故障A-枪恢复";break;
            case 0xA4:fault = "绝缘检测故障B-枪恢复";break;
            case 0xA5:fault = "显示屏通信异常恢复";break;
            case 0xA6:fault = "GPRS通信异常恢复";break;
            case 0xA7:fault = "读卡器通信异常恢复";break;
            case 0xA8:fault = "输出接触器异常恢复";break;
            case 0xA9:fault = "急停故障恢复";break;
            case 0xB0:fault = "模块通信异常恢复";break;
            case 0xB1:fault = "输入接触器预留恢复";break;
            case 0xB2:fault = "门禁故障恢复";break;
            case 0xB3:fault = "模块过温恢复";break;
            case 0xB4:fault = "风扇故障恢复";break;
            case 0xB5:fault = "模块故障恢复";break;
            case 0xB6:fault = "ID重复恢复";break;
            case 0xB7:fault = "输入电压异常恢复";break;
            case 0xB8:fault = "系统过温恢复";break;
            default:fault=String.valueOf(faultCode);
        }
        return fault;
    }
}
